# coding:utf-8
# @Time : 2021/5/5 16:02 
# @Author : minuy
# @File : auth.py
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField
from wtforms.validators import Length

from app.forms.base import DataRequirement


class UserName(FlaskForm):
    """
    用户名表单
    """
    username = StringField('账号',
                           validators=[DataRequirement(),
                                       Length(1, 64, message='账号长度为1-64个字符')])


class LoginForm(UserName):
    """
    登录表单
    """
    password = PasswordField('密码',
                             validators=[DataRequirement(message='密码不可以为空')])
    captcha = StringField('验证码',
                          validators=[DataRequirement(message='验证码不可以为空')])


class RegisterForm(UserName):
    """
    注册表单
    """
    nickname = StringField('昵称',
                           validators=[DataRequirement(),
                                       Length(2, 10, message='昵称长度为2-10个字符')])
    password = PasswordField('密码',
                             validators=[DataRequirement(),
                                         Length(6, 20, message='密码长度为6-20个字符')])
